﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }
    protected void btthemkv_Click(object sender, EventArgs e)
    {
        DataSet ds;
        //Lay du lieu len select
        Dataprovider pa = new Dataprovider();
        ds = pa.get("Select * from Khuvuc");

        //danh cho insert va update
        string strTSQL = "insert into Khuvuc(tinh) values(N'" + txttinh.Text.Trim() + "')";
        bool ketqua = pa.ExeCuteNonQuery(strTSQL);
        WebMsgBox.Show(" Thêm thành công");
    }
    protected void btsuakv_Click(object sender, EventArgs e)
    {
        DataSet ds;
        //Lay du lieu len select
        Dataprovider pa = new Dataprovider();
        ds = pa.get("Select * from Khuvuc");

        //danh cho insert va update
        string strupdate = "Update Khuvuc set Tinh='" + txttinh.Text.Trim() + "' where Makhuvuc='" + txtmakv.Text.Trim() + "'";
        bool ketqua = pa.ExeCuteNonQuery(strupdate);
        WebMsgBox.Show(" Sửa thành công");
    }
    protected void btxoakv_Click(object sender, EventArgs e)
    {
        DataSet ds;
        //Lay du lieu len select
        Dataprovider pa = new Dataprovider();
        ds = pa.get("Select * from Khuvuc");
        string strdelete = "Delete from Khuvuc where Makhuvuc='" + txtmakv.Text.Trim() + "'"; 
        bool ketqua = pa.ExeCuteNonQuery(strdelete);
        WebMsgBox.Show(" Xóa thành công");

    }
}